import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
# 读取 CSV 文件
df = pd.read_csv('C:/Users/Administrator/Desktop/car_prices.csv')

# 统计不同颜色的车辆数量
color_counts = df['color'].value_counts()

# 绘制柱状图
plt.figure(figsize=(10, 6))
sns.barplot(x=color_counts.index, y=color_counts.values)

# 添加数据标签
for i, v in enumerate(color_counts.values):
    plt.text(i, v, str(v), ha='center')

# 设置图表标题和坐标轴标签
plt.title('The Influence of Used Car Color on Sales Quantity')
plt.xlabel('color')
plt.ylabel('Quantity')
plt.xticks(rotation=90)

# 显示图表
plt.show()